package com.zhentao.controller;

import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.wemwdia.dto.NewsAuthDto;
import com.zhentao.model.wemwdia.dto.WmNewsDownOrUpDto;
import com.zhentao.model.wemwdia.dto.WmNewsDto;
import com.zhentao.model.wemwdia.dto.WmNewsPageReqDto;
import com.zhentao.service.WmNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/news")
public class WmNewsController {
    @Autowired
    private WmNewsService wmNewsService;

    @PostMapping("/list")
    public ResponseResult findAll(@RequestBody WmNewsPageReqDto dto) {
        return wmNewsService.findAll(dto);
    }

    @PostMapping("/submit")
    public ResponseResult submitNews(@RequestBody WmNewsDto dto){
        return wmNewsService.submitNews(dto);
    }
    @PostMapping("/down_or_up")
    public ResponseResult downOrUp(@RequestBody WmNewsDownOrUpDto dto){
        return wmNewsService.downOrUp(dto);
    }

    @PostMapping("list_vo")
    public ResponseResult list_vo(@RequestBody NewsAuthDto dto){
        return wmNewsService.list_vo(dto);
    }
    @GetMapping("/one_vo/{id}")
    public ResponseResult one_vo(@PathVariable("id") Integer id){
        return wmNewsService.one_vo(id);
    }
    @PostMapping("/auth_fail")
    public ResponseResult auth_fail(@RequestBody NewsAuthDto dto){
        return wmNewsService.auth_fail(dto);
    }
    @PostMapping("/auth_pass")
    public ResponseResult auth_pass(@RequestBody NewsAuthDto dto){
        return wmNewsService.auth_pass(dto);
    }
}